package org.d8_transform_stream;

import java.io.*;

/**
 * 掌握字符输出转换流的使用
 */
public class InputStreamWriterTest3 {
    public static void main(String[] args) {
        try (
                //1.创建一个文件字节输出流
                OutputStream os = new FileOutputStream("D:\\idea\\idea code\\java-practice\\practice\\change\\file-oi-app\\src\\d8newtest.txt");
                //2.把原始的字节输出流按照指定的字符集编码转换成字符输出流
                Writer osw = new OutputStreamWriter(os,"UTF-8");
                //3.把字符输入流包装成缓冲字符输出流
                BufferedWriter bw = new BufferedWriter(osw);
        )
        {
            bw.write("我爱你中国");
            bw.write("27847842385");

        } catch (Exception e) {
            e.printStackTrace();
        }
    }
 }

